package com.xmb.wechat.old;

import com.xmb.wechat.R;
import com.xmb.wechat.R2;
import com.xmb.wechat.application.WechatStartApplication;
import com.xmb.wechat.base.BaseActivity;
import com.xmb.wechat.bean.WechatLastMsgBean;
import com.xmb.wechat.bean.WechatLastMsgBean_;
import com.xmb.wechat.lsn.OnUnReadCountChangeListener;
import com.xmb.wechat.tab.TabGroupView;
import com.xmb.wechat.tab.TabView;

import butterknife.BindView;

/**
 * @Author lijiangop
 * @CreateTime 2020/4/8 11:21
 */
public class WechatHomeActivity extends BaseActivity implements OnUnReadCountChangeListener {

    @BindView(R2.id.tab_main)
    TabView                 mTabMain;
    @BindView(R2.id.tab_friedns)
    TabView                 mTabFriedns;
    @BindView(R2.id.group_tab_layout)
    TabGroupView            mGroupTabLayout;

    public WechatHomeActivity() {
        super(R.layout.activity_wechat_home);
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void onResume() {
        super.onResume();
        onUnReadCountChange();
    }

    @Override
    public void onUnReadCountChange() {
        int count = (int) WechatStartApplication.getBoxStore().boxFor(WechatLastMsgBean.class).query().build().property(WechatLastMsgBean_.unReadCount).sum();
        mGroupTabLayout.setUnreadCount(0, count);
    }
}
